package com.duanjw.springcloud.account.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * restTemplate配置
 *
 * @author duanjw
 */
@Configuration
public class RestTemplateConfig {
    /**
     * restTemplate配置Ribbon负载均衡
     * 使用@LoadBalanced注解
     *
     * @return
     */
    @Bean
//    @LoadBalanced
    public RestTemplate restTemplate() {
        System.out.println("restTemplate配置Ribbon负载均衡");
        return new RestTemplate();
    }
}
